#!/bin/bash
DB_HOST1="127.0.0.1"
DB_PORT1="5236"
SYSDBA_PWD="Dameng123"
DM_BIN=$(cd "$(dirname "$0")/../dm8/bin";pwd)
#table_type:10 mean dm8 with normal table;11 mean fillfactor_table;12 mean dm8 with partition table;
TABLE_TYPE="10"
TBS_SIZE="512"
#warehouse,partition table only support:100,200,300,400,500,600,800,1000,2000
WAREHOUSES="100"
PARTITION="10"
LOADWORKERS="50"
SCRIPTS_DIR=`pwd`

#选择不同类型的建表脚本
case $TABLE_TYPE in 
  "10")
     usersql=bms5_create_user1.sql
     tablesql=bms5_table.sql
     ;;
  "11")
     usersql=bms5_create_user1.sql
     tablesql=bms5_table_fillfactor.sql
     ;;
  "12")
     usersql=bms5_create_user.sql
     tablesql=bms5_table_partition_${WAREHOUSES}w_${PARTITION}p.sql
     ;;
  *)
     usersql=bms5_create_user1.sql
     tablesql=bms5_table.sql
     ;;
esac

#export var
filename=`echo $(basename $0)|sed 's/.sh//g'`
export filename
export DB_HOST1 DB_PORT1 SYSDBA_PWD
export DM_BIN TABLE_TYPE TBS_SIZE 
export WAREHOUSES PARTITION LOADWORKERS TERMINALS
export tablesql usersql

#add +x
chmod +x ${SCRIPTS_DIR}/01_tpcc/*.sh
chmod +x ${SCRIPTS_DIR}/01_tpcc/tpcc/benchmarksql5/run/*.sh
chmod +x ${SCRIPTS_DIR}/01_tpcc/tpcc/benchmarksql5/run/misc/*
#For bms5
sh ${SCRIPTS_DIR}/01_tpcc/00_load.sh
sleep 1
$(cd "$(dirname "$0")/../init_dm8/";pwd)/DmService stop
sleep 1
